#!/bin/sh

## hyphop ##

sudo=$(which sudo)

. $0.conf

[ "$1" ] && SD=$1

[ "$SD" ] || {
    echo "[e] target device not defined">&2
    exit 1
}

#echo "[i] burn image to $SD">&2

[ -b $SD ] || {
    echo "[e] not block dev $SD">&2
    exit 1
}

for IMG in $IMGS; do
    echo "[i] test $IMG">&2
    [ -f $IMG ] && {

    echo "[i] burn image $IMG > $SD">&2
    ls -la1 $IMG

    $sudo dd if=$IMG bs=1M of=$SD
    sync

    break

    }
done

sleep 1

